<?php
/**
 * Created by PhpStorm.
 * Author: 芸签cms www.yunqiancms.com
 * User: sun
 * Date: 2022/6/27
 * Time: 5:35 PM
 */
namespace app\backend\modules\common\services;

use app\backend\modules\sys\services\PermissionService;
use app\common\helpers\AdminSession;
use app\common\helpers\Cache;
use app\common\models\AdminUser;

class MenuService
{
    static $instance;
    private $mainMenu;
    private $pluginsMenu;
    private $items;
    public function __construct(){
        self::$instance = $this;
    }
    public static function getInstance(){
        if (!isset(self::$instance)) {
            return new static();
        }
        return self::$instance;
    }
    private function mainMenu(){
        if (!isset($this->mainMenu)) {
            $this->mainMenu = $this->_mainMenu();
        }
        return $this->mainMenu;
    }
    private function _mainMenu(){
        $themeIndexUrl = 'theme.market.index';
        if(!\YunCms::autoUpdate()){
            $themeIndexUrl = 'theme.market.local';
        }
        return [
            'index' =>[
                'name' => '概况',
                'url' => 'common.index.dashBoard',
                'url_params' => '',
                'permit' => 0,
                'menu' => 1,
                'top_show' => 0,
                'left_first_show' => 1,
                'left_second_show' => 0,
                'icon' => 'fa-dashboard',
                'sort' => '1',
                'item' => 'index',
                'parents' => [],
                'child' => [
                    'index_dashboard' => [
                        'name' => '概况页',
                        'url' => 'common.index.dashBoard',
                        'url_params' => '',
                        'permit' => 0,
                        'menu' => 0,
                        'icon' => '',
                        'sort' => 0,
                        'item' => 'index_dashboard',
                        'parents' => ['index'],
                        'child' => [
                            'index_dashboard_info' => [
                                'name' => '获取概况数据',
                                'url' => 'common.index.dashBoardInfo',
                                'url_params' => '',
                                'permit' => 0,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'index_dashboard_info',
                                'parents' => ['index','index_dashBoard'],
                                'child' => []
                            ],
                        ]
                    ],
                ]
            ],
            'content' =>[
                'name' => '内容',
                'url' => 'content.category.index',
                'url_params' => '',
                'permit' => 1,
                'menu' => 1,
                'top_show' => 0,
                'left_first_show' => 1,
                'left_second_show' => 1,
                'icon' => 'fa-file-text-o',
                'sort' => '1',
                'item' => 'content',
                'parents' => [],
                'child' => [
                    'content_category' => [
                        'name' => '分类管理',
                        'url' => 'content.category.index',
                        'url_params' => '',
                        'permit' => 1,
                        'menu' => 1,
                        'icon' => '',
                        'sort' => 0,
                        'item' => 'content_category',
                        'parents' => ['content'],
                        'child' => [
                            'content_category_get_list' => [
                                'name' => '分类列表',
                                'url' => 'content.category.getList',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'content_category_get_list',
                                'parents' => ['content','content_category'],
                                'child' => []
                            ],
                            'content_category_query' => [
                                'name' => '检索分类',
                                'url' => 'content.category.query',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'content_category_query',
                                'parents' => ['content','content_category_query'],
                                'child' => []
                            ],
                            'content_category_detail' => [
                                'name' => '分类情页',
                                'url' => 'content.category.detail',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'content_category_detail',
                                'parents' => ['content','content_category'],
                                'child' => []
                            ],
                            'content_category_get_detail' => [
                                'name' => '分类详情数据',
                                'url' => 'content.category.getDetail',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'content_category_get_detail',
                                'parents' => ['content','content_category'],
                                'child' => []
                            ],
                            'content_category_create' => [
                                'name' => '创建分类',
                                'url' => 'content.category.create',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'content_category_create',
                                'parents' => ['content','content_category'],
                                'child' => []
                            ],
                            'content_category_update' => [
                                'name' => '编辑分类',
                                'url' => 'content.category.update',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'content_category_update',
                                'parents' => ['content','content_category'],
                                'child' => []
                            ],
                            'content_category_delete' => [
                                'name' => '删除分类',
                                'url' => 'content.category.delete',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'content_category_delete',
                                'parents' => ['content','content_category'],
                                'child' => []
                            ],
                            'content_category_change_status' => [
                                'name' => '修改分类状态',
                                'url' => 'content.category.changeStatus',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'content_category_change_status',
                                'parents' => ['content','content_category'],
                                'child' => []
                            ],
                        ]
                    ],
                    'content_article' => [
                        'name' => '文章管理',
                        'url' => 'content.article.index',
                        'url_params' => '',
                        'permit' => 1,
                        'menu' => 1,
                        'icon' => '',
                        'sort' => 0,
                        'item' => 'content_article',
                        'parents' => ['content'],
                        'child' => [
                            'content_article_get_list' => [
                                'name' => '文章列表',
                                'url' => 'content.article.getList',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'content_article_get_list',
                                'parents' => ['content','content_article'],
                                'child' => []
                            ],
                            'content_article_query' => [
                                'name' => '检索文章',
                                'url' => 'content.article.query',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'content_article_query',
                                'parents' => ['content','content_article_query'],
                                'child' => []
                            ],
                            'content_article_detail' => [
                                'name' => '文章情页',
                                'url' => 'content.article.detail',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'content_article_detail',
                                'parents' => ['content','content_article'],
                                'child' => []
                            ],
                            'content_article_get_detail' => [
                                'name' => '文章详情数据',
                                'url' => 'content.article.getDetail',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'content_article_get_detail',
                                'parents' => ['content','content_article'],
                                'child' => []
                            ],
                            'content_article_create' => [
                                'name' => '创建文章',
                                'url' => 'content.article.create',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'content_article_create',
                                'parents' => ['content','content_article'],
                                'child' => []
                            ],
                            'content_article_update' => [
                                'name' => '编辑文章',
                                'url' => 'content.article.update',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'content_article_update',
                                'parents' => ['content','content_article'],
                                'child' => []
                            ],
                            'content_article_delete' => [
                                'name' => '删除文章',
                                'url' => 'content.article.delete',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'content_article_delete',
                                'parents' => ['content','content_article'],
                                'child' => []
                            ],
                            'content_article_change_status' => [
                                'name' => '修改文章状态',
                                'url' => 'content.article.changeStatus',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'content_article_change_status',
                                'parents' => ['content','content_article'],
                                'child' => []
                            ],
                        ]
                    ],
                    'content_page' => [
                        'name' => '页面管理',
                        'url' => 'content.page.index',
                        'url_params' => '',
                        'permit' => 1,
                        'menu' => 1,
                        'icon' => '',
                        'sort' => 0,
                        'item' => 'content_page',
                        'parents' => ['content'],
                        'child' => [
                            'content_page_get_list' => [
                                'name' => '页面列表',
                                'url' => 'content.page.getList',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'content_page_get_list',
                                'parents' => ['content','content_page'],
                                'child' => []
                            ],
                            'content_page_query' => [
                                'name' => '检索页面',
                                'url' => 'content.page.query',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'content_page_query',
                                'parents' => ['content','content_page_query'],
                                'child' => []
                            ],
                            'content_page_detail' => [
                                'name' => '页面情页',
                                'url' => 'content.page.detail',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'content_page_detail',
                                'parents' => ['content','content_page'],
                                'child' => []
                            ],
                            'content_page_get_detail' => [
                                'name' => '页面详情数据',
                                'url' => 'content.page.getDetail',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'content_page_get_detail',
                                'parents' => ['content','content_page'],
                                'child' => []
                            ],
                            'content_page_create' => [
                                'name' => '创建页面',
                                'url' => 'content.page.create',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'content_page_create',
                                'parents' => ['content','content_page'],
                                'child' => []
                            ],
                            'content_page_update' => [
                                'name' => '编辑页面',
                                'url' => 'content.page.update',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'content_page_update',
                                'parents' => ['content','content_page'],
                                'child' => []
                            ],
                            'content_page_delete' => [
                                'name' => '删除页面',
                                'url' => 'content.page.delete',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'content_page_delete',
                                'parents' => ['content','content_page'],
                                'child' => []
                            ],
                            'content_page_change_status' => [
                                'name' => '修改页面状态',
                                'url' => 'content.page.changeStatus',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'content_page_change_status',
                                'parents' => ['content','content_page'],
                                'child' => []
                            ],
                        ]
                    ],
                    'content_tag' => [
                        'name' => '标签管理',
                        'url' => 'content.tag.index',
                        'url_params' => '',
                        'permit' => 1,
                        'menu' => 1,
                        'icon' => '',
                        'sort' => 0,
                        'item' => 'content_tag',
                        'parents' => ['content'],
                        'child' => [
                            'content_tag_get_list' => [
                                'name' => '标签列表',
                                'url' => 'content.tag.getList',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'content_tag_get_list',
                                'parents' => ['content','content_tag'],
                                'child' => []
                            ],
                            'content_tag_detail' => [
                                'name' => '标签情页',
                                'url' => 'content.tag.detail',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'content_tag_detail',
                                'parents' => ['content','content_tag'],
                                'child' => []
                            ],
                            'content_tag_get_detail' => [
                                'name' => '标签详情数据',
                                'url' => 'content.tag.getDetail',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'content_tag_get_detail',
                                'parents' => ['content','content_tag'],
                                'child' => []
                            ],
                            'content_tag_create' => [
                                'name' => '创建标签',
                                'url' => 'content.tag.create',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'content_tag_create',
                                'parents' => ['content','content_tag'],
                                'child' => []
                            ],
                            'content_tag_update' => [
                                'name' => '编辑标签',
                                'url' => 'content.tag.update',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'content_tag_update',
                                'parents' => ['content','content_tag'],
                                'child' => []
                            ],
                            'content_tag_delete' => [
                                'name' => '删除标签',
                                'url' => 'content.tag.delete',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'content_tag_delete',
                                'parents' => ['content','content_tag'],
                                'child' => []
                            ],
                            'content_tag_change_status' => [
                                'name' => '修改标签状态',
                                'url' => 'content.tag.changeStatus',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'content_tag_change_status',
                                'parents' => ['content','content_tag'],
                                'child' => []
                            ],
                        ]
                    ],
                    'content_product' => [
                        'name' => '产品管理',
                        'url' => 'content.product.index',
                        'url_params' => '',
                        'permit' => 1,
                        'menu' => 1,
                        'icon' => '',
                        'sort' => 0,
                        'item' => 'content_product',
                        'parents' => ['content'],
                        'child' => [
                            'content_product_get_list' => [
                                'name' => '产品列表',
                                'url' => 'content.product.getList',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'content_product_get_list',
                                'parents' => ['content','content_product'],
                                'child' => []
                            ],
                            'content_product_query' => [
                                'name' => '检索产品',
                                'url' => 'content.product.query',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'content_product_query',
                                'parents' => ['content','content_product_query'],
                                'child' => []
                            ],
                            'content_product_detail' => [
                                'name' => '产品详情页',
                                'url' => 'content.product.detail',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'content_product_detail',
                                'parents' => ['content','content_product'],
                                'child' => []
                            ],
                            'content_product_get_detail' => [
                                'name' => '产品详情数据',
                                'url' => 'content.product.getDetail',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'content_product_get_detail',
                                'parents' => ['content','content_product'],
                                'child' => []
                            ],
                            'content_product_create' => [
                                'name' => '创建产品',
                                'url' => 'content.product.create',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'content_product_create',
                                'parents' => ['content','content_product'],
                                'child' => []
                            ],
                            'content_product_update' => [
                                'name' => '编辑产品',
                                'url' => 'content.product.update',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'content_product_update',
                                'parents' => ['content','content_product'],
                                'child' => []
                            ],
                            'content_product_delete' => [
                                'name' => '删除产品',
                                'url' => 'content.product.delete',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'content_product_delete',
                                'parents' => ['content','content_product'],
                                'child' => []
                            ],
                            'content_product_change_status' => [
                                'name' => '修改产品状态',
                                'url' => 'content.product.changeStatus',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'content_product_change_status',
                                'parents' => ['content','content_product'],
                                'child' => []
                            ],
                        ]
                    ],
                ]
            ],
            'theme' =>[
                'name' => '模版',
                'url' => $themeIndexUrl,
                'url_params' => '',
                'permit' => 1,
                'menu' => 1,
                'top_show' => 0,
                'left_first_show' => 1,
                'left_second_show' => 1,
                'icon' => 'fa-archive',
                'sort' => '1',
                'item' => 'theme',
                'parents' => [],
                'child' => [
                    'theme_market' => [
                        'name' => '模版市场',
                        'url' => $themeIndexUrl,
                        'url_params' => '',
                        'permit' => 1,
                        'menu' => 1,
                        'icon' => '',
                        'sort' => 0,
                        'item' => 'theme_market',
                        'parents' => ['theme'],
                        'child' => [
                            'theme_market_get_list' => [
                                'name' => '获取模版市场列表数据',
                                'url' => 'theme.market.getList',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'theme_market_get_list',
                                'parents' => ['theme','theme_market'],
                                'child' => []
                            ],
                            'theme_market_local' => [
                                'name' => '本地模版',
                                'url' => 'theme.market.local',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'theme_market_local',
                                'parents' => ['theme','theme_market'],
                                'child' => []
                            ],
                            'theme_market_local_list' => [
                                'name' => '获取本地模版列表数据',
                                'url' => 'theme.market.getLocalList',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'theme_market_local_list',
                                'parents' => ['theme','theme_market'],
                                'child' => []
                            ],
                            'theme_market_detail' => [
                                'name' => '模版市场详情页',
                                'url' => 'theme.market.getLocalList',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 1,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'theme_market_local_list',
                                'parents' => ['theme','theme_market'],
                                'child' => []
                            ],
                            'theme_market_get_detail' => [
                                'name' => '获取模版市场详情数据',
                                'url' => 'theme.market.getDetail',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'theme_market_get_detail',
                                'parents' => ['theme','theme_market'],
                                'child' => []
                            ],
                        ]
                    ],
                    'theme_my' => [
                        'name' => '我的模版',
                        'url' => 'theme.theme.index',
                        'url_params' => '',
                        'permit' => 1,
                        'menu' => 1,
                        'icon' => '',
                        'sort' => 0,
                        'item' => 'theme_my',
                        'parents' => ['theme'],
                        'child' => [
                            'theme_my_get_list' => [
                                'name' => '获取列表数据',
                                'url' => 'theme.theme.getList',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'theme_my_get_list',
                                'parents' => ['theme','theme_my'],
                                'child' => []
                            ],
                            'theme_my_used_local' => [
                                'name' => '使用本地模版',
                                'url' => 'theme.theme.usedLocal',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'theme_my_used_local',
                                'parents' => ['theme','theme_my'],
                                'child' => []
                            ],
                            'theme_my_used' => [
                                'name' => '使用模版',
                                'url' => 'theme.theme.used',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'theme_my_used',
                                'parents' => ['theme','theme_my'],
                                'child' => []
                            ],
                            'theme_my_update' => [
                                'name' => '更新模版',
                                'url' => 'theme.theme.update',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'theme_my_update',
                                'parents' => ['theme','theme_my'],
                                'child' => []
                            ],
                            'theme_my_change_status' => [
                                'name' => '修改模版状态',
                                'url' => 'theme.theme.changeStatus',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'theme_my_change_status',
                                'parents' => ['theme','theme_my'],
                                'child' => []
                            ],
                            'theme_my_set_default' => [
                                'name' => '设置默认模版',
                                'url' => 'theme.theme.setDefault',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'theme_my_set_default',
                                'parents' => ['theme','theme_my'],
                                'child' => []
                            ],
                            'theme_my_get_page_list' => [
                                'name' => '获取模版页面列表',
                                'url' => 'theme.theme.getPageList',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'theme_my_get_page_list',
                                'parents' => ['theme','theme_my'],
                                'child' => []
                            ],
                            'theme_my_page_detail' => [
                                'name' => '模版页面详情页',
                                'url' => 'theme.theme.pageDetail',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 1,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'theme_my_page_detail',
                                'parents' => ['theme','theme_my'],
                                'child' => []
                            ],
                            'theme_my_get_page_detail' => [
                                'name' => '获取模版页面详情',
                                'url' => 'theme.theme.getPageDetail',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'theme_my_get_page_detail',
                                'parents' => ['theme','theme_my'],
                                'child' => []
                            ],
                            'theme_my_save_preview' => [
                                'name' => '保存模版预览数据',
                                'url' => 'theme.theme.savePreview',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'theme_my_save_preview',
                                'parents' => ['theme','theme_my'],
                                'child' => []
                            ],
                            'theme_my_preview' => [
                                'name' => '模版预览',
                                'url' => 'theme.theme.preview',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'theme_my_preview',
                                'parents' => ['theme','theme_my'],
                                'child' => []
                            ],
                            'theme_my_save_page' => [
                                'name' => '保存模版数据',
                                'url' => 'theme.theme.savePage',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'theme_my_save_page',
                                'parents' => ['theme','theme_my'],
                                'child' => []
                            ],
                        ]
                    ],
                ]
            ],
            'business' =>[
                'name' => '企业',
                'url' => 'business.department.index',
                'url_params' => '',
                'permit' => 1,
                'menu' => 1,
                'top_show' => 0,
                'left_first_show' => 1,
                'left_second_show' => 1,
                'icon' => 'fa-archive',
                'sort' => '1',
                'item' => 'business',
                'parents' => [],
                'child' => [
                    'business_department' => [
                        'name' => '部门管理',
                        'url' => 'business.department.index',
                        'url_params' => '',
                        'permit' => 1,
                        'menu' => 1,
                        'icon' => '',
                        'sort' => 0,
                        'item' => 'business_department',
                        'parents' => ['business'],
                        'child' => [
                            'business_department_get_list' => [
                                'name' => '部门列表',
                                'url' => 'business.department.getList',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'business_department_get_list',
                                'parents' => ['business','business_department'],
                                'child' => []
                            ],
                            'business_department_create' => [
                                'name' => '部门标签',
                                'url' => 'business.department.create',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'business_department_create',
                                'parents' => ['business','business_department'],
                                'child' => []
                            ],
                            'business_department_update' => [
                                'name' => '编辑部门',
                                'url' => 'business.department.update',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'business_department_update',
                                'parents' => ['business','business_department'],
                                'child' => []
                            ],
                            'business_department_delete' => [
                                'name' => '删除部门',
                                'url' => 'business.department.delete',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'business_department_delete',
                                'parents' => ['business','business_department'],
                                'child' => []
                            ],
                        ]
                    ],
                    'business_staff' => [
                        'name' => '员工管理',
                        'url' => 'business.staff.index',
                        'url_params' => '',
                        'permit' => 1,
                        'menu' => 1,
                        'icon' => '',
                        'sort' => 0,
                        'item' => 'business_staff',
                        'parents' => ['business'],
                        'child' => [
                            'business_staff_get_list' => [
                                'name' => '获取员工列表',
                                'url' => 'business.staff.getList',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'business_staff_get_list',
                                'parents' => ['business','business_staff'],
                                'child' => []
                            ],
                            'business_staff_detail' => [
                                'name' => '员工详情页',
                                'url' => 'business.staff.detail',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'business_staff_detail',
                                'parents' => ['business','business_staff'],
                                'child' => []
                            ],
                            'business_staff_get_detail' => [
                                'name' => '员工详情数据',
                                'url' => 'business.staff.getDetail',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'business_staff_get_detail',
                                'parents' => ['business','business_staff'],
                                'child' => []
                            ],
                            'business_staff_create' => [
                                'name' => '创建员工',
                                'url' => 'business.staff.create',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'business_staff_create',
                                'parents' => ['business','business_staff'],
                                'child' => []
                            ],
                            'business_staff_update' => [
                                'name' => '编辑员工',
                                'url' => 'business.staff.update',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'business_staff_update',
                                'parents' => ['business','business_staff'],
                                'child' => []
                            ],
                            'business_staff_delete' => [
                                'name' => '删除员工',
                                'url' => 'business.staff.delete',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'business_staff_delete',
                                'parents' => ['business','business_staff'],
                                'child' => []
                            ],
                            'business_staff_change_status' => [
                                'name' => '修改员工状态',
                                'url' => 'business.staff.changeStatus',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'business_staff_change_status',
                                'parents' => ['business','business_staff'],
                                'child' => []
                            ],
                        ]
                    ]
                ]
            ],
            'sys' =>[
                'name' => '系统',
                'url' => 'sys.setting.site',
                'url_params' => '',
                'permit' => 1,
                'menu' => 1,
                'top_show' => 0,
                'left_first_show' => 1,
                'left_second_show' => 1,
                'icon' => 'fa-cogs',
                'sort' => '1',
                'item' => 'sys',
                'parents' => [],
                'child' => [
                    'sys_setting_site' => [
                        'name' => '网站信息',
                        'url' => 'sys.setting.site',
                        'url_params' => '',
                        'permit' => 1,
                        'menu' => 1,
                        'icon' => '',
                        'sort' => 0,
                        'item' => 'sys_setting_site',
                        'parents' => ['sys'],
                        'child' => [
                            'sys_setting_site_info' => [
                                'name' => '获取网站信息数据',
                                'url' => 'sys.setting.siteInfo',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'sys_setting_site_info',
                                'parents' => ['sys','sys_setting_site'],
                                'child' => []
                            ],
                            'sys_setting_site_save' => [
                                'name' => '保存网站信息数据',
                                'url' => 'sys.setting.siteSave',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'sys_setting_site_save',
                                'parents' => ['sys','sys_setting_site'],
                                'child' => []
                            ],
                        ]
                    ],
                    'sys_carousel' => [
                        'name' => '幻灯片',
                        'url' => 'sys.carousel.index',
                        'url_params' => '',
                        'permit' => 1,
                        'menu' => 1,
                        'icon' => '',
                        'sort' => 0,
                        'item' => 'sys_carousel',
                        'parents' => ['sys'],
                        'child' => [
                            'sys_carousel_get_list' => [
                                'name' => '获取幻灯片组列表',
                                'url' => 'sys.carousel.getList',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'sys_carousel_get_list',
                                'parents' => ['sys','sys_carousel'],
                                'child' => []
                            ],
                            'sys_carousel_detail' => [
                                'name' => '幻灯片组详情页',
                                'url' => 'sys.carousel.detail',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'sys_carousel_detail',
                                'parents' => ['sys','sys_carousel'],
                                'child' => []
                            ],
                            'sys_carousel_get_detail' => [
                                'name' => '幻灯片组详情数据',
                                'url' => 'sys.carousel.getDetail',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'sys_carousel_get_detail',
                                'parents' => ['sys','sys_carousel'],
                                'child' => []
                            ],
                            'sys_carousel_create' => [
                                'name' => '创建幻灯片组',
                                'url' => 'sys.carousel.create',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'sys_carousel_create',
                                'parents' => ['sys','sys_carousel'],
                                'child' => []
                            ],
                            'sys_carousel_update' => [
                                'name' => '编辑幻灯片组',
                                'url' => 'sys.carousel.update',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'sys_carousel_update',
                                'parents' => ['sys','sys_carousel'],
                                'child' => []
                            ],
                            'sys_carousel_delete' => [
                                'name' => '删除幻灯片组',
                                'url' => 'sys.carousel.delete',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'sys_carousel_delete',
                                'parents' => ['sys','sys_carousel'],
                                'child' => []
                            ],
                            'sys_carousel_item_index' => [
                                'name' => '获取幻灯片列表',
                                'url' => 'sys.carouselItem.index',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'sys_carousel_item_index',
                                'parents' => ['sys','sys_carousel'],
                                'child' => []
                            ],
                            'sys_carousel_item_get_list' => [
                                'name' => '获取幻灯片列表',
                                'url' => 'sys.carouselItem.getList',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'sys_carousel_item_get_list',
                                'parents' => ['sys','sys_carousel'],
                                'child' => []
                            ],
                            'sys_carousel_item_detail' => [
                                'name' => '幻灯片详情页',
                                'url' => 'sys.carouselItem.detail',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'sys_carousel_item_detail',
                                'parents' => ['sys','sys_carousel'],
                                'child' => []
                            ],
                            'sys_carousel_item_get_detail' => [
                                'name' => '幻灯片详情数据',
                                'url' => 'sys.carouselItem.getDetail',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'sys_carousel_item_get_detail',
                                'parents' => ['sys','sys_carousel'],
                                'child' => []
                            ],
                            'sys_carousel_item_create' => [
                                'name' => '创建幻灯片',
                                'url' => 'sys.carouselItem.create',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'sys_carousel_item_create',
                                'parents' => ['sys','sys_carousel'],
                                'child' => []
                            ],
                            'sys_carousel_item_update' => [
                                'name' => '编辑幻灯片',
                                'url' => 'sys.carouselItem.update',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'sys_carousel_item_update',
                                'parents' => ['sys','sys_carousel'],
                                'child' => []
                            ],
                            'sys_carousel_item_change_status' => [
                                'name' => '修改幻灯片状态',
                                'url' => 'sys.carouselItem.changeStatus',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'sys_carousel_item_change_status',
                                'parents' => ['sys','sys_carousel'],
                                'child' => []
                            ],
                            'sys_carousel_item_delete' => [
                                'name' => '删除幻灯片',
                                'url' => 'sys.carouselItem.delete',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'sys_carousel_item_delete',
                                'parents' => ['sys','sys_carousel'],
                                'child' => []
                            ],
                        ]
                    ],
                    'sys_nav' => [
                        'name' => '导航管理',
                        'url' => 'sys.nav.index',
                        'url_params' => '',
                        'permit' => 1,
                        'menu' => 1,
                        'icon' => '',
                        'sort' => 0,
                        'item' => 'sys_nav',
                        'parents' => ['sys'],
                        'child' => [
                            'sys_nav_get_list' => [
                                'name' => '获取导航列表',
                                'url' => 'sys.nav.getList',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'sys_nav_get_list',
                                'parents' => ['sys','sys_nav'],
                                'child' => []
                            ],
                            'sys_nav_query' => [
                                'name' => '检索页面',
                                'url' => 'sys.nav.query',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'sys_nav_query',
                                'parents' => ['sys','sys_nav'],
                                'child' => []
                            ],
                            'sys_nav_detail' => [
                                'name' => '导航情页',
                                'url' => 'sys.nav.detail',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'sys_nav_detail',
                                'parents' => ['sys','sys_nav'],
                                'child' => []
                            ],
                            'sys_nav_get_detail' => [
                                'name' => '导航详情数据',
                                'url' => 'sys.nav.getDetail',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'sys_nav_get_detail',
                                'parents' => ['sys','sys_nav'],
                                'child' => []
                            ],
                            'sys_nav_create' => [
                                'name' => '创建导航',
                                'url' => 'sys.nav.create',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'sys_nav_create',
                                'parents' => ['sys','sys_nav'],
                                'child' => []
                            ],
                            'sys_nav_update' => [
                                'name' => '编辑导航',
                                'url' => 'sys.nav.update',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'sys_nav_update',
                                'parents' => ['sys','sys_nav'],
                                'child' => []
                            ],
                            'sys_nav_delete' => [
                                'name' => '删除导航',
                                'url' => 'sys.nav.delete',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'sys_nav_delete',
                                'parents' => ['sys','sys_nav'],
                                'child' => []
                            ],
                            'sys_nav_menu_index' => [
                                'name' => '导航菜单列表页',
                                'url' => 'sys.navMenu.index',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'sys_nav_menu_index',
                                'parents' => ['sys','sys_nav'],
                                'child' => []
                            ],
                            'sys_nav_menu_get_list' => [
                                'name' => '获取导航菜单列表',
                                'url' => 'sys.navMenu.getList',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'sys_nav_menu_get_list',
                                'parents' => ['sys','sys_nav'],
                                'child' => []
                            ],
                            'sys_nav_menu_query' => [
                                'name' => '检索导航菜单',
                                'url' => 'sys.navMenu.query',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'sys_nav_menu_query',
                                'parents' => ['sys','sys_nav'],
                                'child' => []
                            ],
                            'sys_nav_menu_detail' => [
                                'name' => '导航菜单详情页',
                                'url' => 'sys.navMenu.detail',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'sys_nav_menu_detail',
                                'parents' => ['sys','sys_nav'],
                                'child' => []
                            ],
                            'sys_nav_menu_get_detail' => [
                                'name' => '导航菜单详情数据',
                                'url' => 'sys.navMenu.getDetail',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'sys_nav_menu_get_detail',
                                'parents' => ['sys','sys_nav'],
                                'child' => []
                            ],
                            'sys_nav_menu_create' => [
                                'name' => '创建导航菜单',
                                'url' => 'sys.navMenu.create',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'sys_nav_menu_create',
                                'parents' => ['sys','sys_nav'],
                                'child' => []
                            ],
                            'sys_nav_menu_update' => [
                                'name' => '编辑导航菜单',
                                'url' => 'sys.navMenu.update',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'sys_nav_menu_update',
                                'parents' => ['sys','sys_nav'],
                                'child' => []
                            ],
                            'sys_nav_menu_delete' => [
                                'name' => '删除导航菜单',
                                'url' => 'sys.navMenu.delete',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'sys_nav_menu_delete',
                                'parents' => ['sys','sys_nav'],
                                'child' => []
                            ],
                            'sys_nav_menu_change_status' => [
                                'name' => '修改导航菜单状态',
                                'url' => 'sys.navMenu.changeStatus',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'sys_nav_menu_change_status',
                                'parents' => ['sys','sys_nav'],
                                'child' => []
                            ],
                        ]
                    ],
                    'sys_setting_attach' => [
                        'name' => '存储设置',
                        'url' => 'sys.setting.attach',
                        'url_params' => '',
                        'permit' => 1,
                        'menu' => 1,
                        'icon' => '',
                        'sort' => 0,
                        'item' => 'sys_setting_attach',
                        'parents' => ['sys'],
                        'child' => [
                            'sys_setting_attach_info' => [
                                'name' => '获取存储设置数据',
                                'url' => 'sys.setting.attachInfo',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'sys_setting_attach_info',
                                'parents' => ['sys','sys_setting_attach'],
                                'child' => []
                            ],
                            'sys_setting_attach_save' => [
                                'name' => '保存存储设置数据',
                                'url' => 'sys.setting.attachSave',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'sys_setting_attach_save',
                                'parents' => ['sys','sys_setting_attach'],
                                'child' => []
                            ],
                            'sys_setting_remote_attach' => [
                                'name' => '获取远程存储设置数据',
                                'url' => 'sys.setting.remoteAttach',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'sys_setting_remote_attach',
                                'parents' => ['sys','sys_setting_attach'],
                                'child' => []
                            ],
                            'sys_setting_remote_attach_info' => [
                                'name' => '获取远程存储设置数据',
                                'url' => 'sys.setting.remoteAttachInfo',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'sys_setting_remote_attach_info',
                                'parents' => ['sys','sys_setting_attach'],
                                'child' => []
                            ],
                            'sys_setting_remote_attach_save' => [
                                'name' => '保存远程存储设置数据',
                                'url' => 'sys.setting.remoteAttachSave',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'sys_setting_remote_attach_save',
                                'parents' => ['sys','sys_setting_attach'],
                                'child' => []
                            ],
                        ]
                    ],
                    'sys_role' => [
                        'name' => '角色管理',
                        'url' => 'sys.role.index',
                        'url_params' => '',
                        'permit' => 1,
                        'menu' => 1,
                        'icon' => '',
                        'sort' => 0,
                        'item' => 'sys_auth',
                        'parents' => ['sys'],
                        'child' => [
                            'sys_role_get_list' => [
                                'name' => '获取角色列表',
                                'url' => 'sys.role.getList',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'sys_role_get_list',
                                'parents' => ['sys','sys_auth'],
                                'child' => []
                            ],
                            'sys_role_detail' => [
                                'name' => '角色详情页',
                                'url' => 'sys.role.detail',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'sys_role_detail',
                                'parents' => ['sys','sys_auth'],
                                'child' => []
                            ],
                            'sys_role_get_detail' => [
                                'name' => '角色详情数据',
                                'url' => 'sys.role.getDetail',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'sys_role_get_detail',
                                'parents' => ['sys','sys_auth'],
                                'child' => []
                            ],
                            'sys_role_create' => [
                                'name' => '创建角色',
                                'url' => 'sys.role.create',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'sys_role_create',
                                'parents' => ['sys','sys_auth'],
                                'child' => []
                            ],
                            'sys_role_update' => [
                                'name' => '编辑角色',
                                'url' => 'sys.role.update',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'sys_role_update',
                                'parents' => ['sys','sys_auth'],
                                'child' => []
                            ],
                            'sys_role_delete' => [
                                'name' => '删除角色',
                                'url' => 'sys.role.delete',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'sys_role_delete',
                                'parents' => ['sys','sys_auth'],
                                'child' => []
                            ],
                            'sys_role_change_status' => [
                                'name' => '修改角色状态',
                                'url' => 'sys.role.changeStatus',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'sys_role_change_status',
                                'parents' => ['sys','sys_auth'],
                                'child' => []
                            ],
                            'sys_role_query' => [
                                'name' => '检索角色',
                                'url' => 'sys.role.query',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'sys_role_query',
                                'parents' => ['sys','sys_auth'],
                                'child' => []
                            ],
                            'sys_role_permissions' => [
                                'name' => '角色权限数据',
                                'url' => 'sys.role.permissions',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'sys_role_permissions',
                                'parents' => ['sys','sys_auth'],
                                'child' => []
                            ],
                        ]
                    ],
                    'sys_plugin' => [
                        'name' => '插件管理',
                        'url' => 'sys.plugin.index',
                        'url_params' => '',
                        'permit' => 1,
                        'menu' => 1,
                        'icon' => '',
                        'sort' => 0,
                        'item' => 'sys_plugin',
                        'parents' => ['sys'],
                        'child' => [
                            'sys_plugin_get_list' => [
                                'name' => '获取插件列表',
                                'url' => 'sys.plugin.getList',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'sys_plugin_get_list',
                                'parents' => ['sys','sys_plugin'],
                                'child' => []
                            ],
                            'sys_plugin_manage' => [
                                'name' => '管理插件',
                                'url' => 'sys.plugin.manage',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'sys_plugin_manage',
                                'parents' => ['sys','sys_plugin'],
                                'child' => []
                            ],
                            'sys_plugin_batch_manage' => [
                                'name' => '批量管理插件',
                                'url' => 'sys.plugin.batchMange',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'sys_plugin_batch_manage',
                                'parents' => ['sys','sys_plugin'],
                                'child' => []
                            ],
                            'sys_plugin_market_index' => [
                                'name' => '插件市场页面',
                                'url' => 'sys.pluginMarket.index',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'sys_plugin_market_index',
                                'parents' => ['sys','sys_plugin'],
                                'child' => []
                            ],
                            'sys_plugin_market_get_list' => [
                                'name' => '获取插件市场数据列表',
                                'url' => 'sys.pluginMarket.getList',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'sys_plugin_market_get_list',
                                'parents' => ['sys','sys_plugin'],
                                'child' => []
                            ],
                            'sys_plugin_market_detail' => [
                                'name' => '插件市场插件详情页面',
                                'url' => 'sys.pluginMarket.detail',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'sys_plugin_market_detail',
                                'parents' => ['sys','sys_plugin'],
                                'child' => []
                            ],
                            'sys_plugin_market_get_detail' => [
                                'name' => '获取插件市场插件详情',
                                'url' => 'sys.pluginMarket.getDetail',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'sys_plugin_market_get_detail',
                                'parents' => ['sys','sys_plugin'],
                                'child' => []
                            ],
                            'sys_plugin_market_install' => [
                                'name' => '安装插件市场插件',
                                'url' => 'sys.pluginMarket.install',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'sys_plugin_market_install',
                                'parents' => ['sys','sys_plugin'],
                                'child' => []
                            ],
                            'sys_plugin_market_batch_install' => [
                                'name' => '批量安装插件市场插件',
                                'url' => 'sys.pluginMarket.batchInstall',
                                'url_params' => '',
                                'permit' => 1,
                                'menu' => 0,
                                'icon' => '',
                                'sort' => 0,
                                'item' => 'sys_plugin_market_batch_install',
                                'parents' => ['sys','sys_plugin'],
                                'child' => []
                            ],
                        ]
                    ],
                ]
            ],
            'application' => [
                'name' => '应用',
                'url' => 'sys.plugin.application',
                'url_params' => '',
                'permit' => 1,
                'menu' => 1,
                'top_show' => 0,
                'left_first_show' => 1,
                'left_second_show' => 0,
                'icon' => '',
                'sort' => 0,
                'item' => 'application',
                'parents' => [],
                'child' => [
                ]
            ]
        ];
    }

    private function _getItems(){
        $menuListCacheKey = "menuList_" . \YunCms::$adminUid;

        if (!$this->items) {
            if (!Cache::has($menuListCacheKey)) {

                $pluginMenu = $this->getPluginMenus() ?: [];
                //菜单生成
                $menuList = array_merge($this->mainMenu(),$pluginMenu);
                $this->items = $menuList;
                //递归调用
                $this->items = static::validateMenuPermit($this->items);
                Cache::put($menuListCacheKey, $this->items, 3600);
            }
            $this->items = Cache::get($menuListCacheKey);
        }

        return $this->items;
    }
    public function getItems(){
        if (!isset($this->items)) {
            $this->items = $this->_getItems();
        }
        return $this->items;
    }
    public function setPluginMenu($key, $value = null)
    {
        if (is_array($key)) {
            $this->pluginsMenu = array_merge($this->pluginsMenu, $key);
        } else {
            array_set($this->pluginsMenu, $key, $value);
        }
    }
    private function _getPluginMenus()
    {
        $plugins = app('plugins')->getEnabledPlugins();
        foreach ($plugins as $plugin) {
            $plugin->app()->loadMenuConfig();
        }
        return $this->pluginsMenu;
    }

    public function getPluginMenus()
    {
        if (!isset($this->pluginsMenu)) {
            $this->pluginsMenu = $this->_getPluginMenus();
        }
        return $this->pluginsMenu;
    }
    /**
     * 递归菜单项,设置can字段
     * @param array $menuList
     * @return array
     */
    public static function validateMenuPermit(array $menuList){
        foreach ($menuList as $key => &$item) {
            $item['can'] = true;
            $item['permit'] && ($item['can'] = PermissionService::can($key));
            // 父菜单无权限时,不再验证子菜单权限
            if ($item['can'] && $item['child']) {
                $item['child'] = static::validateMenuPermit($item['child']);
            }
        }
        return $menuList;
    }
    private function _getCurrentItems()
    {
        $item = self::getCurrentItemByRoute(request()->input('route'), $this->getItems());

        $result = array_merge(self::getCurrentMenuParents($item, $this->getItems()), [$item]);

        return $result;
    }
    public function isShowSecondMenu()
    {
        $menu_list = (array)$this->getItems();
        if (count($this->getCurrentItems()) >= 1) {
            return isset($menu_list[$this->getCurrentItems()[0]]['left_second_show']) ? $menu_list[$this->getCurrentItems()[0]]['left_second_show'] : false;
        }
        return false;
    }
    public function getCurrentItems()
    {
        if (!isset($this->currentItems)) {
            $this->currentItems = $this->_getCurrentItems();
        }
        return $this->currentItems;
    }
    /**
     * 获取 item from route
     * @param $route
     * @param array $menuList
     * @return array|int|mixed|string
     */
    public static function getCurrentItemByRoute($route, array $menuList){
        static $current = null;
        foreach($menuList as $key=>$value){
            if(isset($value['url']) && $value['url'] == $route){
                $current = $key;
                break;
            }
            if(isset($value['child']) && $value['child']){
                $current = self::getCurrentItemByRoute($route,$value['child']);
            }
        }

        return $current;
    }
    /**
     * 获取当前菜单父级item
     * @param $item
     * @param array $menuList
     * @return mixed
     */
    public static function getCurrentMenuParents($item, array $menuList)
    {
        static $current = [];
        foreach($menuList as $key=>$value){
            if($key == $item){
                $current = $value['parents'];
                break;
            }
            if(isset($value['child']) && $value['child']){
                $current = self::getCurrentMenuParents($item,$value['child']);
            }
        }
        return $current;
    }
    //可以进入的路由
    public static function canAccess($item)
    {
        $current_menu = self::getInstance()->getItems()[$item];
        $url = absolute_admin_url($current_menu['url']) . ($current_menu['url_params'] ? '&' . $current_menu['url_params'] : '');


        if (\YunCms::$isFounder) {
            return $url;
        }

        if (!isset($current_menu['child'])) {
            return $url;
        }

        $userPermission = AdminUser::userPermissionCache();
        //检测当前 key 下路由是否有权限访问
        foreach ($current_menu['child'] as $key => $value) {

            if ($value['url'] == $current_menu['url'] && in_array($key, $userPermission)) {
                return $url;
                break;
            }
            continue;
        }
        //上面条件都不满足时，找第一个有权限访问的路由
        foreach ($current_menu['child'] as $key => $value) {

            if (in_array($key, $userPermission)) {
                return absolute_admin_url($value['url']) . ($value['url_params'] ? '&' . $value['url_params'] : '');
                break;
            }
            continue;
        }
        return absolute_admin_url('index.index');
    }
}
